package com.hx.testpackage;

import com.hx.entity.Cups;
import com.hx.entity.Regions;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/test")
public class TestSpring {
@RequestMapping(value = "get",method = RequestMethod.GET)
    public Map list(){
    Map<String,Object> map=new HashMap<>();
    map.put("diyi",1354);

    return map;
}
    @RequestMapping(value = "getcup")
    public Cups getCup(){
        WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();
        Cups cups= (Cups) wac.getBean("cups");
        return cups;
    }
}
